import time
from selenium import webdriver
import os
driver = webdriver.Chrome()
file = "file:///" + os.path.abspath("e:\比特课件\selenium2html/modal.html")
driver.get(file)
driver.maximize_window()
driver.find_element_by_link_text("Click").click()
time.sleep(3)
div0 = driver.find_element_by_class_name("modal-body")
div0.find_element_by_id("click").click()
time.sleep(4)
div1 = driver.find_element_by_class_name("modal-footer")
# div1.find_element_by_class_name("btn").click()
buttons = div1.find_elements_by_tag_name("button")
#buttons[0].click()
for n in buttons:
    if n.get_attribute("button") == 'Close':
        n.click()
time.sleep(4)
driver.quit()

